home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Hardware / PowerManager DDK 1.0f1 / Interfaces&Libraries / Interfaces / QuickdrawText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-08  |  10.9 KB  |  356 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QuickdrawText.h
  3.  
  4.      Contains:    Quickdraw Text Interfaces.
  5.  
  6.      Version:    Mac OS 8.5
  7.  
  8.      DRI:        Joseph Maurer
  9.  
  10.      Copyright:    © 1983-1999 by Apple Computer, Inc., all rights reserved.
  11.  
  12.      Warning:    *** APPLE INTERNAL USE ONLY ***
  13.                  This file may contain unreleased API's
  14.  
  15.      BuildInfo:    Built by:            Scott Johnson
  16.                  On:                    10/8/99 11:27 AM
  17.                  With Interfacer:    3.0d13   (MPW PowerPC)
  18.                  From:                QuickdrawText.i
  19.                      Revision:        32
  20.                      Dated:            5/5/99
  21.                      Last change by:    DSL
  22.                      Last comment:    [2319482]  Remove obsolete (accoding to Appendix D of Inside
  23.  
  24.      Bugs:        Report bugs to Radar component "System Interfaces", "Latest"
  25.                  List the version information (from above) in the Problem Description.
  26.  
  27. */
  28. #ifndef __QUICKDRAWTEXT__
  29. #define __QUICKDRAWTEXT__
  30.  
  31. #ifndef __MACTYPES__
  32. #include <MacTypes.h>
  33. #endif
  34.  
  35. #ifndef __MIXEDMODE__
  36. #include <MixedMode.h>
  37. #endif
  38.  
  39.  
  40.  
  41.  
  42. #if PRAGMA_ONCE
  43. #pragma once
  44. #endif
  45.  
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49.  
  50. #if PRAGMA_IMPORT
  51. #pragma import on
  52. #endif
  53.  
  54. #if PRAGMA_STRUCT_ALIGN
  55.     #pragma options align=mac68k
  56. #elif PRAGMA_STRUCT_PACKPUSH
  57.     #pragma pack(push, 2)
  58. #elif PRAGMA_STRUCT_PACK
  59.     #pragma pack(2)
  60. #endif
  61.  
  62. /* new CGrafPort bottleneck ("newProc2") function, used in Unicode Text drawing */
  63. EXTERN_API_C( OSStatus )
  64. StandardGlyphs                    (void *                    dataStream,
  65.                                  ByteCount                 size);
  66.  
  67.  
  68. enum {
  69.                                                                 /* CharToPixel directions */
  70.     leftCaret                    = 0,                            /*Place caret for left block*/
  71.     rightCaret                    = -1,                            /*Place caret for right block*/
  72.     kHilite                        = 1                                /*Direction is SysDirection*/
  73. };
  74.  
  75. enum {
  76.     smLeftCaret                    = 0,                            /*Place caret for left block - obsolete */
  77.     smRightCaret                = -1,                            /*Place caret for right block - obsolete */
  78.     smHilite                    = 1                                /*Direction is TESysJust - obsolete */
  79. };
  80.  
  81. enum {
  82.                                                                 /*Constants for styleRunPosition argument in PortionLine, DrawJustified, MeasureJustified, CharToPixel, and PixelToChar.*/
  83.     onlyStyleRun                = 0,                            /* This is the only style run on the line */
  84.     leftStyleRun                = 1,                            /* This is leftmost of multiple style runs on the line */
  85.     rightStyleRun                = 2,                            /* This is rightmost of multiple style runs on the line */
  86.     middleStyleRun                = 3,                            /* There are multiple style runs on the line and this is neither the leftmost nor the rightmost. */
  87.     smOnlyStyleRun                = 0,                            /* obsolete */
  88.     smLeftStyleRun                = 1,                            /* obsolete */
  89.     smRightStyleRun                = 2,                            /* obsolete */
  90.     smMiddleStyleRun            = 3                                /* obsolete */
  91. };
  92.  
  93. /* type for styleRunPosition parameter in PixelToChar etc. */
  94. typedef short                             JustStyleCode;
  95. /*QuickTime3.0*/
  96. enum {
  97.                                                                 /* Constants for txFlags (which used to be the pad field after txFace) */
  98.     tfAntiAlias                    = 1 << 0,
  99.     tfUnicode                    = 1 << 1
  100. };
  101.  
  102.  
  103.  
  104. struct FontInfo {
  105.     short                             ascent;
  106.     short                             descent;
  107.     short                             widMax;
  108.     short                             leading;
  109. };
  110. typedef struct FontInfo                    FontInfo;
  111.  
  112. typedef short                             FormatOrder[1];
  113. typedef FormatOrder *                    FormatOrderPtr;
  114. /* FormatStatus was moved to TextUtils.i */
  115.  
  116. struct OffPair {
  117.     short                             offFirst;
  118.     short                             offSecond;
  119. };
  120. typedef struct OffPair                    OffPair;
  121.  
  122. typedef OffPair                         OffsetTable[3];
  123. typedef CALLBACK_API( Boolean , StyleRunDirectionProcPtr )(short styleRunIndex, void *dirParam);
  124. typedef STACK_UPP_TYPE(StyleRunDirectionProcPtr)                 StyleRunDirectionUPP;
  125. #if OPAQUE_UPP_TYPES
  126.     EXTERN_API(StyleRunDirectionUPP)
  127.     NewStyleRunDirectionUPP           (StyleRunDirectionProcPtr userRoutine);
  128.  
  129.     EXTERN_API(void)
  130.     DisposeStyleRunDirectionUPP       (StyleRunDirectionUPP    userUPP);
  131.  
  132.     EXTERN_API(Boolean)
  133.     InvokeStyleRunDirectionUPP       (short                    styleRunIndex,
  134.                                     void *                    dirParam,
  135.                                     StyleRunDirectionUPP    userUPP);
  136.  
  137. #else
  138.     enum { uppStyleRunDirectionProcInfo = 0x00000390 };             /* pascal 1_byte Func(2_bytes, 4_bytes) */
  139.     #define NewStyleRunDirectionUPP(userRoutine)                     (StyleRunDirectionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, GetCurrentArchitecture())
  140.     #define DisposeStyleRunDirectionUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  141.     #define InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppStyleRunDirectionProcInfo, (styleRunIndex), (dirParam))
  142. #endif
  143. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  144. #define NewStyleRunDirectionProc(userRoutine)                     NewStyleRunDirectionUPP(userRoutine)
  145. #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam) InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userRoutine)
  146. #if CALL_NOT_IN_CARBON
  147. EXTERN_API( short )
  148. Pixel2Char                        (Ptr                     textBuf,
  149.                                  short                     textLen,
  150.                                  short                     slop,
  151.                                  short                     pixelWidth,
  152.                                  Boolean *                leadingEdge)                        FOURWORDINLINE(0x2F3C, 0x820E, 0x0014, 0xA8B5);
  153.  
  154. EXTERN_API( short )
  155. Char2Pixel                        (Ptr                     textBuf,
  156.                                  short                     textLen,
  157.                                  short                     slop,
  158.                                  short                     offset,
  159.                                  short                     direction)                            FOURWORDINLINE(0x2F3C, 0x820C, 0x0016, 0xA8B5);
  160.  
  161. #endif  /* CALL_NOT_IN_CARBON */
  162.  
  163. EXTERN_API( short )
  164. PixelToChar                        (Ptr                     textBuf,
  165.                                  long                     textLength,
  166.                                  Fixed                     slop,
  167.                                  Fixed                     pixelWidth,
  168.                                  Boolean *                leadingEdge,
  169.                                  Fixed *                widthRemaining,
  170.                                  JustStyleCode             styleRunPosition,
  171.                                  Point                     numer,
  172.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8222, 0x002E, 0xA8B5);
  173.  
  174. EXTERN_API( short )
  175. CharToPixel                        (Ptr                     textBuf,
  176.                                  long                     textLength,
  177.                                  Fixed                     slop,
  178.                                  long                     offset,
  179.                                  short                     direction,
  180.                                  JustStyleCode             styleRunPosition,
  181.                                  Point                     numer,
  182.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x821C, 0x0030, 0xA8B5);
  183.  
  184. EXTERN_API( void )
  185. DrawJustified                    (Ptr                     textPtr,
  186.                                  long                     textLength,
  187.                                  Fixed                     slop,
  188.                                  JustStyleCode             styleRunPosition,
  189.                                  Point                     numer,
  190.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8016, 0x0032, 0xA8B5);
  191.  
  192. EXTERN_API( void )
  193. MeasureJustified                (Ptr                     textPtr,
  194.                                  long                     textLength,
  195.                                  Fixed                     slop,
  196.                                  Ptr                     charLocs,
  197.                                  JustStyleCode             styleRunPosition,
  198.                                  Point                     numer,
  199.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x801A, 0x0034, 0xA8B5);
  200.  
  201. EXTERN_API( Fixed )
  202. PortionLine                        (Ptr                     textPtr,
  203.                                  long                     textLen,
  204.                                  JustStyleCode             styleRunPosition,
  205.                                  Point                     numer,
  206.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8412, 0x0036, 0xA8B5);
  207.  
  208. EXTERN_API( void )
  209. HiliteText                        (Ptr                     textPtr,
  210.                                  short                     textLength,
  211.                                  short                     firstOffset,
  212.                                  short                     secondOffset,
  213.                                  OffsetTable             offsets)                            FOURWORDINLINE(0x2F3C, 0x800E, 0x001C, 0xA8B5);
  214.  
  215. #if CALL_NOT_IN_CARBON
  216. EXTERN_API( void )
  217. DrawJust                        (Ptr                     textPtr,
  218.                                  short                     textLength,
  219.                                  short                     slop)                                FOURWORDINLINE(0x2F3C, 0x8008, 0x001E, 0xA8B5);
  220.  
  221. EXTERN_API( void )
  222. MeasureJust                        (Ptr                     textPtr,
  223.                                  short                     textLength,
  224.                                  short                     slop,
  225.                                  Ptr                     charLocs)                            FOURWORDINLINE(0x2F3C, 0x800C, 0x0020, 0xA8B5);
  226.  
  227. EXTERN_API( Fixed )
  228. PortionText                        (Ptr                     textPtr,
  229.                                  long                     textLength)                            FOURWORDINLINE(0x2F3C, 0x8408, 0x0024, 0xA8B5);
  230.  
  231. #endif  /* CALL_NOT_IN_CARBON */
  232.  
  233. EXTERN_API( long )
  234. VisibleLength                    (Ptr                     textPtr,
  235.                                  long                     textLength)                            FOURWORDINLINE(0x2F3C, 0x8408, 0x0028, 0xA8B5);
  236.  
  237. EXTERN_API( void )
  238. GetFormatOrder                    (FormatOrderPtr         ordering,
  239.                                  short                     firstFormat,
  240.                                  short                     lastFormat,
  241.                                  Boolean                 lineRight,
  242.                                  StyleRunDirectionUPP     rlDirProc,
  243.                                  Ptr                     dirParam)                            FOURWORDINLINE(0x2F3C, 0x8012, 0xFFFC, 0xA8B5);
  244.  
  245. EXTERN_API( void )
  246. TextFont                        (short                     font)                                ONEWORDINLINE(0xA887);
  247.  
  248. EXTERN_API( void )
  249. TextFace                        (StyleParameter         face)                                ONEWORDINLINE(0xA888);
  250.  
  251. EXTERN_API( void )
  252. TextMode                        (short                     mode)                                ONEWORDINLINE(0xA889);
  253.  
  254. EXTERN_API( void )
  255. TextSize                        (short                     size)                                ONEWORDINLINE(0xA88A);
  256.  
  257. EXTERN_API( void )
  258. SpaceExtra                        (Fixed                     extra)                                ONEWORDINLINE(0xA88E);
  259.  
  260. EXTERN_API( void )
  261. DrawChar                        (CharParameter             ch)                                    ONEWORDINLINE(0xA883);
  262.  
  263. EXTERN_API( void )
  264. DrawString                        (ConstStr255Param         s)                                    ONEWORDINLINE(0xA884);
  265.  
  266. #if TARGET_OS_MAC
  267.     #define MacDrawText DrawText
  268. #endif
  269. EXTERN_API( void )
  270. MacDrawText                        (const void *            textBuf,
  271.                                  short                     firstByte,
  272.                                  short                     byteCount)                            ONEWORDINLINE(0xA885);
  273.  
  274. EXTERN_API( short )
  275. CharWidth                        (CharParameter             ch)                                    ONEWORDINLINE(0xA88D);
  276.  
  277. EXTERN_API( short )
  278. StringWidth                        (ConstStr255Param         s)                                    ONEWORDINLINE(0xA88C);
  279.  
  280. EXTERN_API( short )
  281. TextWidth                        (const void *            textBuf,
  282.                                  short                     firstByte,
  283.                                  short                     byteCount)                            ONEWORDINLINE(0xA886);
  284.  
  285. EXTERN_API( void )
  286. MeasureText                        (short                     count,
  287.                                  const void *            textAddr,
  288.                                  void *                    charLocs)                            ONEWORDINLINE(0xA837);
  289.  
  290. EXTERN_API( void )
  291. GetFontInfo                        (FontInfo *                info)                                ONEWORDINLINE(0xA88B);
  292.  
  293. EXTERN_API( void )
  294. CharExtra                        (Fixed                     extra)                                ONEWORDINLINE(0xAA23);
  295.  
  296. EXTERN_API( void )
  297. StdText                            (short                     count,
  298.                                  const void *            textAddr,
  299.                                  Point                     numer,
  300.                                  Point                     denom)                                ONEWORDINLINE(0xA882);
  301.  
  302. EXTERN_API( short )
  303. StdTxMeas                        (short                     byteCount,
  304.                                  const void *            textAddr,
  305.                                  Point *                numer,
  306.                                  Point *                denom,
  307.                                  FontInfo *                info)                                ONEWORDINLINE(0xA8ED);
  308.  
  309.  
  310. EXTERN_API_C( void )
  311. drawstring                        (const char *            s);
  312.  
  313. EXTERN_API_C( short )
  314. stringwidth                        (const char *            s);
  315.  
  316. EXTERN_API_C( void )
  317. stdtext                            (short                     count,
  318.                                  const void *            textAddr,
  319.                                  const Point *            numer,
  320.                                  const Point *            denom);
  321.  
  322. #if OLDROUTINENAMES
  323. #define NPixel2Char(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) \
  324.     PixelToChar(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) 
  325. #define NChar2Pixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom) \
  326.     CharToPixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom)
  327. #define NDrawJust(textPtr, textLength, slop, styleRunPosition, numer, denom) \
  328.     DrawJustified(textPtr, textLength, slop, styleRunPosition, numer, denom)
  329. #define NMeasureJust(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom) \
  330.     MeasureJustified(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)
  331. #define NPortionText(textPtr, textLen, styleRunPosition, numer, denom)\
  332.     PortionLine(textPtr, textLen, styleRunPosition, numer, denom)
  333. #endif  /* OLDROUTINENAMES */
  334.  
  335.  
  336. #if PRAGMA_STRUCT_ALIGN
  337.     #pragma options align=reset
  338. #elif PRAGMA_STRUCT_PACKPUSH
  339.     #pragma pack(pop)
  340. #elif PRAGMA_STRUCT_PACK
  341.     #pragma pack()
  342. #endif
  343.  
  344. #ifdef PRAGMA_IMPORT_OFF
  345. #pragma import off
  346. #elif PRAGMA_IMPORT
  347. #pragma import reset
  348. #endif
  349.  
  350. #ifdef __cplusplus
  351. }
  352. #endif
  353.  
  354. #endif /* __QUICKDRAWTEXT__ */
  355.  
  356.